﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace gChartSharp
{
    public class ChartDataSeriesCollection : CollectionBase, IChartParam
    {
        public string Name { get { return "chd"; } }

        public EncodingType EncodingType { get; set; }

        public ChartDataSeriesCollection(EncodingType encodingType)
        {
            this.EncodingType = encodingType;
        }

        public string Render()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(String.Format("{0}={1}:", this.Name, this.EncodingType.ToString()));

            foreach (ChartDataSeries series in List)
            {
                sb.Append(series.Render());
                sb.Append("|");
            }

            if (sb.Length > 0)
                sb.Length--;

            return sb.ToString();
        }

        public void Add(ChartDataSeries series)
        {
            List.Add(series);
        }
    }
}
